<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    
    function transformation(str) {
        let str2 = str.split('')
        // console.log(str2);
        for ( let i = 0; i < str2.length; i++) {
            if (str2[i].charCodeAt() >= 65 && str2[i].charCodeAt() <= 90) {
                str2[i]=str2[i].toLowerCase()
            }
            else{
                str2[i]=str2[i].toUpperCase()
            }
        }
        console.log(str2.join(''));
    }
    transformation('HeLLoWoRd')
    
</script>